package com.ssc.controller;

import com.ssc.common.AjaxResult;
import com.ssc.common.UserUtils;
import com.ssc.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by tengj on 2017/3/13.
 */
@Controller
public class LoginController {


    @RequestMapping(value = "/login",method = RequestMethod.POST)
    @ResponseBody
    public String login(HttpServletRequest request, HttpServletResponse response){

        AjaxResult result = AjaxResult.createSuccess();

        String userName=request.getParameter("userName");
        String password=request.getParameter("password");
        if(!userName.equals("") && password!=""){
            User user =new User();
            UserUtils.setCurrentUser(user);
        }else{
            result.failure();
        }
        return result.toString();
    }


}
